package com.skivingcloud.common.utils;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Map;

public class GenericClass<T>{
    private Class<T> type;

    public GenericClass() {
        Type genericSuperclass = getClass().getGenericSuperclass();
        if (genericSuperclass instanceof ParameterizedType paramType) {
            type = (Class<T>) paramType.getActualTypeArguments()[0];
        }
    }

    public Class<T> getType() {
        return type;
    }

    public static Class<Map<String, String>> getMapStringClassType(){
        GenericClass<Map<String, String>> genericClass = new GenericClass<>();
        return genericClass.getType();
    }

    public static Class<Map<String, Object>> getMapClassType(){
        GenericClass<Map<String, Object>> genericClass = new GenericClass<>();
        return genericClass.getType();
    }
}
